<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
    *{
        margin:0;
        padding: 0;
        box-sizing: border-box;
    }
    .main{
        width: 1000px;
        margin:20px auto;
    }
    .buttons{
        width: 100%;
        display: flex;
    }
    .buttons > input{
        flex: 1;
    }
    .box{
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
        margin-top: 10px;
    }
    .box > img{
        width: 23%;
        display: block;
        margin-bottom: 10px;
    }
    .box > img:hover{
        box-shadow: 0 0 4px 2px gray;
    }
    </style>
</head>
<body>
    <div class="main">
        <div class="buttons">
            <input type="button" value="上一页" id="Last"> 
            <input type="button" value="下一页" id="Next">
        </div>
        <div id="box" class="box"></div>
    </div>
</body>
</body>
<script>
    // 获取元素
    var box = document.getElementById('box');
    var Last = document.getElementById('Last');
    var Next = document.getElementById('Next');

    // 获取数据 准备数组
    var arrs = ['./images/00_03.png','./images/00_04.png','./images/00_05.png',
                    './images/00_06.png','./images/00_07.png','./images/00_24.png',
                    './images/00_16.png','./images/00_10.png','./images/00_11.png',
                    './images/00_12.png','./images/00_13.png','./images/00_14.png',
                    './images/00_16.png','./images/00_17.png','./images/00_18.png',
                    './images/00_19.png','./images/00_20.png','./images/00_26.png',
                    './images/00_22.png','./images/00_23.png'
    ]
        // 循环数组
        function MyFunction(start,end){
            var html = '';
            for(var i = start; i <= end; i++){
                html += '<img src = "'+arrs[i]+'">'
            }
            box.innerHTML = html;
        }
        // 调用函数
        MyFunction(0,7)

        // 切换下一页
        var  pagecount = 1;
        Next.onclick = function(){
            if(pagecount == Math.ceil(arrs.length /  8)){
                alert('再见');
                return;
            }
            pagecount++;
            var start = (pagecount - 1) * 8;
            var end = start + 7;
            if(end > arrs.length - 1){
                end = arrs.length - 1
            }
            MyFunction(start,end)
        }

        // 切换上一页
        Last.onclick = function(){
            if(pagecount === 1){
                alert('告辞!')
                return;
            }
            pagecount--;
            var start = (pagecount - 1) * 8;
            var end = start + 7;
            MyFunction(start,end)
        }
</script>
</html>